from info.index import index_blue
from flask import render_template,request,current_app
import random
from ..pabaidu import paiqu

@index_blue.route('/')
def index():
    try:
        type=request.args.get('type')

        if type !='':
            # data=request.form.get('type')
            #这是数据库版本
            # redis_=redis.StrictRedis()
            a=random.randint(6,53)
            # print(a)
            # list_=redis_.lrange('fengjing',a-6,a+6)
            # list_=[i.decode() for i in list_]
            # print(list_[1])
            list_=paiqu(type)[a-6:a+6]
            # print(list_)
            return render_template('zhaopian.html',
                                   list_jpg=list_)
        list_=''
        return render_template('zhaopian.html',
                               list_jpg=list_)
    except:
        list_=''
        return render_template('zhaopian.html',
                               list_jpg=list_)

